#include<bits/stdc++.h>
#define int long long
using namespace std;

inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-48,ch=getchar();}
	return x*f;
}
int a[1000005],b[1000005];
signed main(){
	freopen("game.in","r",stdin);
	freopen("game.out","w",stdout);
	int T=read();
	while(T--){
		int n=read();
		int res=0;
		for(int i=1;i<=n;i++) a[i]=read();
		for(int i=1;i<=n;i++){
			int x=read();
			res+=abs(a[i]-x);
		}
		printf("%lld\n",res);
	}
    return 0;
}